﻿using NUnit.Framework;
using Sucdri.Domain.Model;
using Sucdri.Infrastructure.Core.Cache;

namespace Sucdri.Infrastructure.Core.Test.CacheHelperTest
{
   [TestFixture]
   public class CacheHelperTest
   {
      private const string key = "testKey";
      private readonly ProjectMain obj = new ProjectMain
      {
         RprjName = "TEST",
         RprjNum = "1",
         RprjRoleID = 1,
         RprjPlatformID = 1
      };

      [SetUp]
      public void SetUp()
      {
         CacheHelper.PutItem(key, obj);
      }

      [TearDown]
      public void TearDown()
      {
         CacheHelper.RemoveItem(key);
      }

      [Test]
      public void PutItemTest()
      {
         Assert.IsTrue(CacheHelper.Exists(key));
      }

      [Test]
      public void GetItemTest()
      {
         Assert.AreSame(obj, CacheHelper.GetItem<ProjectMain>(key));
      }
   }
}